#define _CRT_SECURE_NO_WARNINGS 1
int lengthOfLongestSubstring(char* s)
{
    int len = strlen(s);
    int left = 0;
    int right = 1;
    int Max = 0;
    int tmp = left;
    if (len == 1)
        return 1;
    while (right < len)
    {
        int flag = 0;
        while (tmp < right)
        {
            if (s[tmp] != s[right])
            {
                tmp++;
            }
            else
            {
                flag = -1;
                break;
            }
        }
        if (flag == -1)
            left = tmp + 1;

        tmp = left;
        Max = (right - left + 1) > Max ? (right - left + 1) : Max;
        right++;
    }
    return Max;
}

